/**
 * 全局变量
 */
var selectUserId = '';
$(function(){
    /*
    * 加载列表数据
    * */
    $('#listGrid').datagrid({
        url:ROOT_PATH+'/risk/region/queryListByParam.shtml',
        queryParams:{
            sort:'addTime',
            order:'desc'
        },
        idField:'id',
        fitColumns:true,
        pagination:true,
        rownumbers:true,
        singleSelect:true,
        sortOrder:true,
        striped:true,
        fit:true,
        columns:[[
            {field:'id',width:10,checkbox:true},
            {field:'name',title:'风险区域名称',width:10},
            {field:'shortName',title:'风险区域简称',width:10},
            {field:'typeName',title:'风险区域类别',width:10},
            {field:'deptName',title:'风险区域所在部门',width:10},
            {field:'pointNum',title:'风险点个数',width:10},
            {field:'remarks',title:'备注',width:10}
        ]],
        toolbar: '#toolbar'
    });
    /**
     * 加载下拉列表信息
     *
     */
    //绑定按钮事件
    //查询按钮绑定事件
    $("#btn_select").on('click',function(){
        var selectedRow =  $('#listGrid').datagrid('getSelected');
        WindowManager.closeLayer({
            returnValue:selectedRow
        });
    });
    $("#btn_search").on('click',function(){
        searchFun();
    });
    $('#btn_clear').on('click',function(){
        $('#searchForm1').form('clear');
       // $('#searchForm2').form('clear');
    });

});


/**
 * 查询按钮方法
 */
function searchFun(){
    var search =$('#searchForm1').serializeJson();
    //var search2 =$('#searchForm2').serializeJson();
    //var search = $.extend(search1,search2);
    //排序参数
    search.sort = "addTime";
    search.order='desc';
    $('#listGrid').datagrid('load',search);
}